//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include "TConnectionListener.h"
#include <Classes.hpp>
#include <ComCtrls.hpp>
#include "TRegistHandler.h"
#include "TRosterHandler.h"
#include "TNotes.h"
#include "TBookMarks.h"
#include "TMessageManager.h"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components

	TPanel *Panel1;
	TLabel *Label1;
	TEdit *txtUser;
	TLabel *Label2;
	TEdit *txtPwd;
	TLabel *Label3;
	TEdit *txtHost;
	TButton *btLogin;
	TButton *txtLogout;
	TPanel *Panel2;
	TLabel *Label4;
	TComboBox *lsUsers;
	TLabel *Label5;
	TEdit *Edit1;
	TButton *btSend;
	TPanel *Panel3;
	TMemo *moMsgs;
	TPanel *Panel4;
	TLabel *Label6;
	TEdit *txtPort;
	TButton *Button1;
	TPanel *pnl1;
	TMemo *moLog;
	TTreeView *tv1;
	TButton *Button2;
	void __fastcall btLoginClick(TObject *Sender);
	void __fastcall txtLogoutClick(TObject *Sender);
	void __fastcall Button2Click(TObject *Sender);
	void __fastcall btSendClick(TObject *Sender);
	void __fastcall Button1Click(TObject *Sender);
private:	// User declarations
	TConnListener *connlsn;
	TRosterHandler *rostermgr;
	TNotes *noteslist;
	TBookMarks *bm;
	TMessageManager *mmgr;
	void __fastcall OnConnected(TObject *Sender);
	void __fastcall OnDisConnected(ConnectionError e);
	bool __fastcall OnTLSConnected(const CertInfo &info);
	void __fastcall Logit(UnicodeString msg);
	void __fastcall LogMsg(UnicodeString msg);
	void __fastcall OnLog(LogLevel level, LogArea area, const std::string message);
	void __fastcall OnVCard( const JID& jid, const VCard *v );
	void __fastcall OnVCardResult( int context, const JID& jid, StanzaError se);

	void __fastcall OnRegistrationFields( const JID& from, int fields, std::string instructions );
	void __fastcall OnRegistrationResult( const JID& from, RegistrationResult result );
	void __fastcall OnAlreadyRegistered( const JID& from );
	void __fastcall OnDataForm( const JID& from, const DataForm& form );
	void __fastcall OnOOB( const JID& from, const OOB& oob );

	void __fastcall OnItemSubscribed( const JID& jid );
	void __fastcall OnItemAdded( const JID& jid );//jid.bare().c_str()
	void __fastcall OnItemUnsubscribed( const JID& jid );
	void __fastcall OnItemRemoved( const JID& jid );
	void __fastcall OnItemUpdated( const JID& jid );
	void __fastcall OnRosterItem( const std::string jid,const std::string name,const char* group,const char* resname,const int state,bool Online);
	void __fastcall OnRosterError( const IQ& iq );
	void __fastcall OnRosterPresence( const RosterItem& item, const std::string& resource,
										   Presence::PresenceType presence, const std::string& msg );
	void __fastcall OnSelfPresence( const RosterItem& item, const std::string& resource,
										   Presence::PresenceType presence, const std::string& msg );
	bool __fastcall OnSubscriptionRequest( const JID& jid, const std::string& msg );

	bool __fastcall OnUnsubscriptionRequest( const JID& jid, const std::string& msg );
	void __fastcall OnNonrosterPresence( const Presence& presence );

	void __fastcall OnNotes( const std::string jid,const std::string note,std::string ctime,std::string mtime);

	void __fastcall OnBookMarkItem( const std::string name, const std::string url);
	void __fastcall OnConfrenceItem( const std::string jid, const std::string name,const std::string nick,const std::string password,bool autojoin);

	void __fastcall OnMessageSession( MessageSession *session );
	void __fastcall OnMessage( const Message& msg, MessageSession * session);
	void __fastcall OnMessageEvent( const JID& from, MessageEventType event );
	void __fastcall OnChatState( const JID& from, ChatStateType state );
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
#endif
